home *** CD-ROM | disk | FTP | other *** search
- /* ------------ modem.c --------- */
-
- #include <dos.h>
- #include <conio.h>
- #include "serial.h"
- #include "modem.h"
-
- char DIAL[] = "ATDT";
- char PHONENO[21];
-
- int direct_connection; /* true if connected without a modem */
-
- /* ----------- write a command to the modem ------------ */
- static void modout(char *s)
- {
- while(*s) {
- if (*s == '~')
- sleep(1);
- else if (!writecomm(*s))
- break;
- s++;
- }
- }
-
- /* ----------- initialize the modem ---------- */
- void initmodem(void)
- {
- intercept_timer();
- initcomport();
- if (!direct_connection) {
- modout(RESETMODEM);
- modout(INITMODEM);
- clear_serial_queue();
- }
- }
-
- /* -------- release the modem --------- */
- void release_modem(void)
- {
- if (!direct_connection)
- modout(RESETMODEM);
- restore_timer();
- restore_serialint();
- clear_serial_queue();
- }
-
- /* ----------- place a call -------------- */
- void placecall(void)
- {
- if (!direct_connection) {
- modout(DIAL);
- modout(PHONENO);
- modout("\r");
- clear_serial_queue();
- }
- }
-
- /* ------------- answer a call ------------ */
- void answercall(void)
- {
- if (!direct_connection) {
- modout(ANSWER);
- clear_serial_queue();
- }
- }
-
- /* ------------ disconnect the call ----------------- */
- void disconnect(void)
- {
- if (!direct_connection) {
- modout(HANGUP);
- clear_serial_queue();
- }
- }
-